package cn.com.bluemoon.daps.standard.vo;

import cn.com.bluemoon.daps.standard.entity.DapSystemCategory;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.Size;

/**
 * base
 *  没有id
 *
 * @author Jarod.Kong
 */
@ApiModel(description = "主题或分类的新增接收器")
@Data
public class TopicCategoryBaseVo {

    @ApiModelProperty(value = "分类代码")
    @Size(max = 20, message = "分类代码不超过{max}")
    private String code;

    @ApiModelProperty(value = "分类名称")
    @Size(max = 10, message = "分类名称不超过{max}")
    private String codeName;

    @ApiModelProperty(value = "针对主题或者分类来定义全称")
    @Size(max = 50, message = "全称不超过{max}")
    private String fullName;

    @ApiModelProperty(value = "说明分类")
    @Size(max = 300, message = "说明不超过{max}")
    private String remark;

    @ApiModelProperty(value = "是否为主题，true为主题 反之为分类", hidden = true)
    private transient Integer topic;

    public TopicCategoryBaseVo() {
    }

    public TopicCategoryBaseVo(DapSystemCategory systemCategory) {
        BeanUtils.copyProperties(systemCategory, this);
    }

    public DapSystemCategory toModel() {
        DapSystemCategory category = new DapSystemCategory();
        BeanUtils.copyProperties(this, category);
        return category;
    }
}
